package main

import (
	"fmt"
	"sort"
)

func main() {
	arr1 := []int{3, 2}
	arr2 := []int{}
	r := findMedianSortedArrays(arr1, arr2)
	fmt.Println(r)
}

func findMedianSortedArrays(nums1 []int, nums2 []int) float64 {
	var arr []int

	for _, v := range nums1 {
		arr = append(arr, v)
	}

	for _, v := range nums2 {
		arr = append(arr, v)
	}

	sort.Ints(arr)

	if len(arr) == 0 {
		return 0
	} else if len(arr) == 1 {
		return float64(arr[0])
	} else {
		mid := 0

		mid = len(arr) / 2

		fmt.Println(arr, mid)

		if len(arr)%2 == 0 {
			return float64(arr[mid-1]+arr[mid]) / 2.0
		}
		return float64(arr[mid])
	}
}
